import re
headers_str = """
Accept: application/json, text/javascript, */*; q=0.01
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6
Cache-Control: no-cache
Connection: keep-alive
Content-Length: 21
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Cookie: SESSION=85f74c1a-3c59-45fb-9913-fc258461377f
Host: www.ems.com.cn
Origin: https://www.ems.com.cn
Pragma: no-cache
Referer: https://www.ems.com.cn/pc/main/new
sec-ch-ua: " Not;A Brand";v="99", "Microsoft Edge";v="91", "Chromium";v="91"
sec-ch-ua-mobile: ?0
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36 Edg/91.0.864.71
X-Requested-With: XMLHttpRequest
"""

for line in headers_str.splitlines():
	# \1和\2用来匹配分组的内容
    print(re.sub('^(.*?): (.*)$',r"'\1': '\2',",line))
